<template>
  <div>
    <ul>
      <li v-for="item in list" :key="item">{{ item }}</li>
    </ul>
    <button @click="fn">按钮1</button>
    <button @click="fn1">按钮2</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: ["jojo", "犬夜叉", "机器猫"],
    };
  },
  methods: {
    fn() {
      this.list.unshift(this.list[this.list.length - 1]);
      this.list.pop();
    },
    fn1() {
      this.list.push(this.list[0]);
      this.list.shift();
    },
  },
};
</script>

<style scoped></style>
